#include "tcpServer.hpp"
#include "daemon.hpp"
#include <memory>

void Usage(const char* proc)
{
    std::cout << "Usage:\n\t" << proc << " local_port" << std::endl;
}

int main(int argc, char*argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t port = atoi(argv[1]);
    std::unique_ptr<tcpServer>tsevr(new tcpServer(port));
    tsevr->initServer();

    //守护进程化
    deamonSelf();

    tsevr->start();

    return 0;
}